﻿namespace ApiLib.AppStart;

/// <summary>
/// 全局常量
/// </summary>
public static class GlobalConstants
{
    /// <summary>
    /// 用户缓存key
    /// </summary>
    public const string CacheUserKey = "userinfo_by_id_";

    /// <summary>
    /// 主数据库
    /// </summary>
    public const string MainDbConfigId = "MySql";

    /// <summary>
    /// Swagger分组
    /// </summary>
    public const string ApiDescriptionSettings = "ApiLib";
    /// <summary>
    /// 用户缓存前缀
    /// </summary>
    public const string UserCachePrefix = "token_";

    /// <summary>
    /// 常用正则
    /// </summary>
    public static class SimplePattern
    {
        /// <summary>
        /// 中文
        /// </summary>
        public const string Chinese = "[\\u4e00-\\u9fa5]";

        /// <summary>
        /// 双字节字符，包括汉字
        /// </summary>
        public const string TwoCharacter = "[^\\x00-\\xff]";

        /// <summary>
        /// 空白行
        /// </summary>
        public const string EmptyLine = "\\n\\s*\\r";

        /// <summary>
        /// 邮件
        /// </summary>
        public const string Email =
            "[\\w!#$%&'*+/=?^_`{|}~-]+(?:\\.[\\w!#$%&'*+/=?^_`{|}~-]+)*@(?:[\\w](?:[\\w-]*[\\w])?\\.)+[\\w](?:[\\w-]*[\\w])?";

        /// <summary>
        /// 网址
        /// </summary>
        public const string WebUrl = "[a-zA-z]+://[^\\s]*";

        /// <summary>
        /// 手机号
        /// </summary>
        public const string MobilePhone = "[1][3,4,5,6,7,8,9][0-9]{9}";

        /// <summary>
        /// ip地址
        /// </summary>
        public const string IpAddress = "\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}";

        /// <summary>
        /// 国内电话号码，座机，
        /// </summary>
        [Obsolete("不建议使用，使用时严格注意格式")] public const string Phone = "\\d{3}-\\d{8}|\\d{4}-\\d{7,8}";

        /// <summary>
        /// QQ号
        /// </summary>
        public const string QqNumber = "[1-9][0-9]{4,}";

        /// <summary>
        /// 邮政编码
        /// </summary>
        public const string PostNumber = "[1-9]\\d{5}(?!\\d)";

        /// <summary>
        /// 日期（年-月-日）
        /// </summary>
        public const string Date =
            "([0-9]{3}[1-9]|[0-9]{2}[1-9][0-9]{1}|[0-9]{1}[1-9][0-9]{2}|[1-9][0-9]{3})-(((0[13578]|1[02])-(0[1-9]|[12][0-9]|3[01]))|((0[469]|11)-(0[1-9]|[12][0-9]|30))|(02-(0[1-9]|[1][0-9]|2[0-8])))";

        /// <summary>
        /// 正整数
        /// </summary>
        public const string PositiveInteger = "[1-9]\\d*";

        /// <summary>
        /// 负整数
        /// </summary>
        public const string NegativeInteger = "-[1-9]\\d*";

        /// <summary>
        /// 证书
        /// </summary>
        public const string Integer = "-?[1-9]\\d*";

        /// <summary>
        /// 非负整数（正整数+0）
        /// </summary>
        public const string NoneNegativeInteger = "[1-9]\\d*|0";

        /// <summary>
        /// 非正整数（负整数+0）
        /// </summary>
        public const string NonePositiveInteger = "-[1-9]\\d*|0";

        /// <summary>
        /// 正浮点数
        /// </summary>
        public const string PositiveFloat = "[1-9]\\d*\\.\\d*|0\\.\\d*[1-9]\\d*";

        /// <summary>
        /// 负浮点数
        /// </summary>
        public const string NegativeFloat = "-[1-9]\\d*\\.\\d*|-0\\.\\d*[1-9]\\d*";

        /// <summary>
        /// HTML元素标签
        /// </summary>
        public const string Html = "<[^>]*>";

        /// <summary>
        /// HTML元素属性
        /// </summary>
        public const string HtmlAttribute = "\\s*[^=\\s+]+\\s*=\\s*([^=>]+)?(?=(\\s+|>))";
    }

    /// <summary>
    /// 系统配置
    /// </summary>
    public static class SystemConfigKey
    {
        /// <summary>
        /// 系统数据关键字
        /// </summary>
        public const string SystemKey = "System";

        /// <summary>
        /// 记录请求
        /// </summary>
        public const string RecordRequest = "RecordRequest";
    }

    /// <summary>
    /// 上传目录
    /// </summary>
    public static string UploadDir => Path.Combine(AppContext.BaseDirectory, GlobalConfig.UploadPath);

    /// <summary>
    /// 上传临时目录，临时目录
    /// </summary>
    public static string UploadTempDir => Path.Combine(AppContext.BaseDirectory, GlobalConfig.UploadPath, "temp");


    /// <summary>
    /// 文件类型
    /// </summary>
    public static class FileContentType
    {
        /// <summary>
        /// 表格
        /// </summary>
        public const string Excel = "application/vnd.ms-excel";

        /// <summary>
        /// 文件
        /// </summary>
        public const string Normal = "application/octet-stream";
    }

    /// <summary>
    /// BannerString
    /// </summary>
    public static class BannerString
    {
        /// <summary>
        /// 独角兽
        /// </summary>
        public const string Unicorn = @"
                      . . . .                 
                      ,`,`,`,`,               
. . . .               `\`\`\`\;               
`\`\`\`\`,            ~|;!;!;\!               
 ~\;\;\;\|\          (--,!!!~`!       .       
(--,\\\===~\         (--,|||~`!     ./        
 (--,\\\===~\         `,-,~,=,:. _,//         
  (--,\\\==~`\        ~-=~-.---|\;/J,         
   (--,\\\((```==.    ~'`~/       a |         
     (-,.\\('('(`\\.  ~'=~|     \_.  \        
        (,--(,(,(,'\\. ~'=|       \\_;>       
          (,-( ,(,(,;\\ ~=/        \          
          (,-/ (.(.(,;\\,/          )         
           (,--/,;,;,;,\\         ./------.   
             (==,-;-'`;'         /_,----`. \  
     ,.--_,__.-'                    `--.  ` \ 
    (='~-_,--/        ,       ,!,___--. \  \_)
   (-/~(     |         \   ,_-         | ) /_|
   (~/((\    )\._,      |-'         _,/ /     
    \\))))  /   ./~.    |           \_\;      
 ,__/////  /   /    )  /                      
  '===~'   |  |    (, <.                      
           / /       \. \                     
         _/ /          \_\                    
        /_!/            >_\                   
";

        /// <summary>
        /// 爱情
        /// </summary>
        public const string Love = @"
                                       --.     
          @@@                         /  ))    
         (( }                         7_ /     
         ``)                            / \    
        ``( \  @@@                     |<| |   
       ```\`.\_`|/                    /|/| |   
      ```` )|---~                    / | | |   
     ~~~~~/ \`                    o_)\/| |_|   
         / ' \`                        |__>)   
        /  '  \`                       || |    
       /   '    `                      |\ \    
      /   _!__.-._`                    | \ \   
     /_.-'    ( \                      | |\ \  
     /,        ` \                     |_| \_\ 
    |`_         |`_                  __'_)__.-'
";

        /// <summary>
        /// 键盘
        /// </summary>
        public const string Keyboard = @"
.-----------------------------------------------------------------------------.
||Es| |F1 |F2 |F3 |F4 |F5 | |F6 |F7 |F8 |F9 |F10|                  C= AMIGA   |
||__| |___|___|___|___|___| |___|___|___|___|___|                             |
| _____________________________________________     ________    ___________   |
||~  |! |"" |§ |$ |% |& |/ |( |) |= |? |` || |<-|   |Del|Help|  |{ |} |/ |* |  |
||`__|1_|2_|3_|4_|5_|6_|7_|8_|9_|0_|ß_|´_|\_|__|   |___|____|  |[ |]_|__|__|  |
||<-  |Q |W |E |R |T |Z |U |I |O |P |Ü |* |   ||               |7 |8 |9 |- |  |
||->__|__|__|__|__|__|__|__|__|__|__|__|+_|_  ||               |__|__|__|__|  |
||Ctr|oC|A |S |D |F |G |H |J |K |L |Ö |Ä |^ |<'|               |4 |5 |6 |+ |  |
||___|_L|__|__|__|__|__|__|__|__|__|__|__|#_|__|       __      |__|__|__|__|  |
||^    |> |Y |X |C |V |B |N |M |; |: |_ |^     |      |A |     |1 |2 |3 |E |  |
||_____|<_|__|__|__|__|__|__|__|,_|._|-_|______|    __||_|__   |__|__|__|n |  |
|   |Alt|A  |                       |A  |Alt|      |<-|| |->|  |0    |. |t |  |
|   |___|___|_______________________|___|___|      |__|V_|__|  |_____|__|e_|  |
|                                                                             |
`-----------------------------------------------------------------------------'
";

        /// <summary>
        /// 美女
        /// </summary>
        public const string Woman = @"
                                                              
                                .::::.                        
                              .::::::::.                      
                              :::::::::::                     
                              ':::::::::::..                  
                               :::::::::::::::'               
                                ':::::::::::.                 
                                  .::::::::::::::'            
                                .:::::::::::...               
                               ::::::::::::::''               
                   .:::.       '::::::::''::::                
                 .::::::::.      ':::::'  '::::               
                .::::':::::::.    :::::    '::::.             
              .:::::' ':::::::::. :::::      ':::.            
            .:::::'     ':::::::::.:::::       '::.           
          .::::''         '::::::::::::::       '::.          
         .::''              '::::::::::::         :::...      
      ..::::                  ':::::::::'        .:' ''''     
   ..''''':'                    ':::::.'                      
                                                              
";

        /// <summary>
        /// 美女
        /// </summary>
        public const string Woman2 = @"
     $$$$$$$$                       
     $$$$$$$$$$                     
    $$$$$$$$$$$$                    
    $$$$$$$$$$$$                    
    $$$$$$$$$$$$                    
   $$$$$$$$$$$$$                    
  $$$$$$$$$$$$$                     
  $$$$$$$$$$$$$                     
  $$$$$$$$$$$$$$$$                  
 $$$$$$$$$$$$$$$$$$$$               
 $$$$$$$$$$$$$$$$$$$$$$$            
 $$$$$$$$$$$$$$$$$$$$$$$$           
  $$$$$$  $$$$$$$$$$$$$$            
    $$$$    $$$$$$$$$$$             
    $$$$     $$$$$$$$$$             
    $$$$     $$$$$$$$$$             
     $$$$    $$$$$$$$$$             
      $$$    $$$$$$$$$              
       $$$  $$$$$$$$$$              
        $$$$$$$$$$$$$$              
         $$$$$$$$$$$$$$             
        $$$$$$$$$$$$$$$$$$          
        $$$$$$$$$$$$$$$$$$$$$       
        $$$$$$$$$$$$$$$$$$$$$$$$$   
        $$$$$$$$$$$$$$$$$$$$$$$$$$$ 
         $$$$$$$$$$    $$$$$$$$$$$$$
          $$$$$$$$       $$$$$$$$$$$
          $$$$$$$$     $$$$$$$$$$$  
          $$$$$$$    $$$$$$$$$$     
          $$$$$$$ $$$$$$$$$$        
         $$$$$$$$$$$$$$$            
         $$$$$$$$$$$$               
         $$$$$$$$$$                 
        $$$$$$$$                    
        $$$$$$                      
       $$$$$$                       
       $$$$$$                       
       $$$$$$                       
       $$$$$                        
       $$$$$                        
        $$$$                        
        $$$$                        
        $$$$                        
       $$$$$                        
       $$$$$                        
        $$$$                        
         $$$$$                      
         $$$$                       
";

        /// <summary>
        /// 美女
        /// </summary>
        public const string Woman3 = @"
       .                       
       |`.                     
       ;  `.                   
       ; :. \           __     
       ; ; \ \      .--""  \    
       ; ;  ; ;     :      \   
       ; ;  : :     ; ;     ;  
       ' :   ; ;    ;::     :  
        \ \  : ;--.-;; l     ; 
         \ \  ;:    :;//'-.__: 
         /\ \ ::____:::-\      
        /  ).:+'""""""""""""""""=\     
       :_,=""""     /""-.    ;    
       ;""       .'    `.  |    
      :      .-^=    ==.\ |    
      |  _.-"".gp      gp:;:    
      ;    /  $$      $$;: ;   
     :    :  `--      --:  |   
     ;    ;\        ,   '  |   
    :    :  \      _   /   :   
    ;    |   `.   `-' /     ;  
   :     :    :`-.__.'      |  
   ;          ;     :       |  
  :     ...._/      '.__..  |  
  ;   .'                  \ ;  
 :   /                   _ Y   
 ;  :         .g$$p.    d$$+.  
 ;  ;     :.g$$$$$$$$p.d$$$$$b 
 :  :     :$$$$$$$$$$$T$$$$$$$;
  \  ;    ;$$$$S$$$$$$$S$$$$$P 
   `.|    |$$$$S$$$$$$$S$$$$P  
     |    |T$$$$$SSSSS$$$$$$   
     :    | `T$$$$$$$$$$$$$;   
      ;   |   $$$$$$$$$$$$$    
      |   :   $$$$$$$$$$$$;    
      :    ; d$$$$$$$$$$$$;    
      |    :d$$$$$$$$$$$$$$    
      ;    :""^T$$$$$$$$$$$$b   
     :     ;   `T$$$$$$$$$$P;  
     ;    :      `T$$$$$$$P :  
     |    ;        T$$$$$P   ; 
     |   :          T$$P'    ; 
     :   ;           $'      : 
    ._;__;           :       : 
    ; ;  ;           |       : 
    :_L__:           |       ; 
    .'    ;          |       ; 
  .'      :          |      :  
 :/ _.-.  :;         |      |  
 /.'    \ |:         |      ;  
//  bug  ;| ;        |     :   
`        `' :        |     |   
             ;       |     ;   
             :       |    :    
              ;      |    |    
              :      :    ;    
              :    _.'-   ;    
              ;     /:    :    
             /     / ;     ;   
            /     :  ;     :   
           :      ;  ;     :   
           ;     :  :      :   
          :      ;  :      ;   
          ;     :   ;     :    
         :      ;   ;     ;    
         ;     :    ;    :     
         ;     ;    ;    ;     
         ;    :     ;   :      
         |    ;     ;   ;      
         |   :      ;  :       
         |   ;      ;  ;       
         :  :       :  ;       
         ;  :       :  :       
        :    ,      ;   ;      
        ;    ;      ;   :      
       :     :      :    ;     
       :     ;      :b__d$     
       $b   d$       $$$$$     
       :$bgd$;        T$P'     
        T$$$P                  
         '""'                   
";

        /// <summary>
        /// 佛主
        /// </summary>
        public const string Buddha = @"
////////////////////////////////////////////////////////////////////
//                          _ooOoo_                               //
//                         o8888888o                              //
//                         88"" . ""88                              //
//                         (| ^_^ |)                              //
//                         O\  =  /O                              //
//                      ____/`---'\____                           //
//                    .'  \\|     |//  `.                         //
//                   /  \\|||  :  |||//  \                        //
//                  /  _||||| -:- |||||-  \                       //
//                  |   | \\\  -  /// |   |                       //
//                  | \_|  ''\---/''  |   |                       //
//                  \  .-\__  `-`  ___/-. /                       //
//                ___`. .'  /--.--\  `. . ___                     //
//              ."" '<  `.___\_<|>_/___.'  >'"".                  //
//            | | :  `- \`.;`\ _ /`;.`/ - ` : | |                 //
//            \  \ `-.   \_ __\ /__ _/   .-` /  /                 //
//      ========`-.____`-.___\_____/___.-`____.-'========         //
//                           `=---='                              //
//      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^        //
//              佛祖保佑       永不宕机     永无BUG                   //
////////////////////////////////////////////////////////////////////
";

        /// <summary>
        /// 艺术
        /// </summary>
        public const string Art = @"
         __                    
        / /\                   
       / /  \                  
      / /    \__________       
     / /      \        /\      
    /_/        \      / /      
 ___\ \      ___\____/_/_      
/____\ \    /___________/\     
\     \ \   \           \ \    
 \     \ \   \____       \ \   
  \     \ \  /   /\       \ \  
   \   / \_\/   / /        \ \ 
    \ /        / /__________\/ 
     /        / /     /        
    /        / /     /         
   /________/ /\    /          
   \________\/\ \  /           
               \_\/             
";

        /// <summary>
        /// 艺术
        /// </summary>
        public const string Art2 = @"
                __                
               / /\               
              / / /\              
             / / /\ \             
            / / /\ \ \            
 __________/_/_/__\ \ \__________ 
/\ \_______________\ \ \_________\
\ \ \_______________\ \ \________/
 \ \ \  / / /        \ \ \  / / / 
  \ \ \/ / /          \ \ \/ / /  
   \ \/ / /            \ \/ / /   
    \/ / /              \/ / /    
    / / /\              / / /\    
   / / /\ \            / / /\ \   
  / / /\ \ \          / / /\ \ \  
 /_/_/__\ \ \________/_/_/__\ \ \ 
/________\ \ \_______________\ \ \
\_________\ \ \_______________\_\/
           \ \ \  / / /           
            \ \ \/ / /            
             \ \/ / /             
              \/ / /              
               \/_/               
";

        /// <summary>
        /// 元素周期表
        /// </summary>
        public const string Periodic = @"
  -----                    Periodic table                             -----
1 | H |                                                               |He |
  |---+----                                       --------------------+---|
2 |Li |Be |                                       | B | C | N | O | F |Ne |
  |---+---|                                       |---+---+---+---+---+---|
3 |Na |Mg |3B  4B  5B  6B  7B |    8B     |1B  2B |Al |Si | P | S |Cl |Ar |
  |---+---+---------------------------------------+---+---+---+---+---+---|
4 | K |Ca |Sc |Ti | V |Cr |Mn |Fe |Co |Ni |Cu |Zn |Ga |Ge |As |Se |Br |Kr |
  |---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---|
5 |Rb |Sr | Y |Zr |Nb |Mo |Tc |Ru |Rh |Pd |Ag |Cd |In |Sn |Sb |Te | I |Xe |
  |---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---|
6 |Cs |Ba |LAN|Hf |Ta | W |Re |Os |Ir |Pt |Au |Hg |Tl |Pb |Bi |Po |At |Rn |
  |---+---+---+------------------------------------------------------------
7 |Fr |Ra |ACT|                                                            
  -------------                                                            
              -------------------------------------------------------------
   Lanthanide |La |Ce |Pr |Nd |Pm |Sm |Eu |Gd |Tb |Dy |Ho |Er |Tm |Yb |Lu |
              |---+---+---+---+---+---+---+---+---+---+---+---+---+---+---|
   Actinide   |Ac |Th |Pa | U |Np |Pu |Am |Cm |Bk |Cf |Es |Fm |Md |No |Lw |
              -------------------------------------------------------------
";

        /// <summary>
        /// 程序员
        /// </summary>
        public const string Coder = @"
     _______________________________________      
   ,'            江城子. 程序员之歌            `.   
  /                                            \  
 /          十年生死两茫茫，写程序，到天亮。         \  
|              千行代码，Bug何处藏。               |  
|         纵使上线又怎样，朝令改，夕断肠。           |  
|                                              |  
 \         纵使上线又怎样，朝令改，夕断肠。         /  
  \            相顾无言，惟有泪千行。            /   
   \       每晚灯火阑珊处，夜难寐，加班狂。       /    
    `._______  ____________________________.'     
          / ,'                                     
         / '                                       
      O /'                                         
     /|-'                                          
     /|                                            
";
    }
}